//
//  WBDemoViewController.swift
//  weibo
//
//  Created by 长城 on 16/12/9.
//  Copyright © 2016年 dhsr. All rights reserved.
//

import UIKit

class WBDemoViewController: WBBaseViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        
        //设置标题
        title = "第\(navigationController?.childViewControllers.count ?? 0)个"
    }
    /// MARK:-监听方法
    /// 继续push一个控制器
    /// - Returns: nil
    func showNext(){
        let vc = WBDemoViewController()
        navigationController?.pushViewController(vc, animated: true)
    }

}

extension WBDemoViewController{
    override func setupUI() {
        super.setupUI()
        //navigationItem.rightBarButtonItem = UIBarButtonItem(title: "下一个", style: .plain, target: self, action: #selector(showNext))
//        let btn = UIButton(type: .system)
//        btn.frame = CGRect(x: 0, y: 0, width: 50, height: 50)
//        btn.setTitle("下一个", for: .normal)
//        btn.setTitleColor(#colorLiteral(red: 0.9372549057, green: 0.3490196168, blue: 0.1921568662, alpha: 1), for: .highlighted)
//        btn.contentHorizontalAlignment = .left
//        btn.addTarget(self, action: #selector(showNext), for: .touchUpInside)
//        navigationItem.rightBarButtonItem = UIBarButtonItem(customView: btn)
        navigationItem.rightBarButtonItem = UIBarButtonItem(title: "下一个", target: self, action: #selector(showNext))

    }
}
